package cn.mynb.dao;

import java.io.Serializable;
import java.util.List;

import cn.mynb.util.PageModel;

public interface DaoBase<T>  {
	/**
	 * 保存对象
	 * @param t
	 * @return true of false
	 * @throws Exception
	 */
	public int saveDao(T t) throws Exception ;
	
	public Serializable saveSerializableDao(T t) throws Exception ;
	
	/**
	 * 删除单个对象
	 * @param t 对象id必须存在
	 * @return
	 * @throws Exception
	 */
	public int deleteDao(T t) throws Exception ; 
	
	public int updateDao(T t) throws Exception ;
	
	public T queryByIdDao(int id) throws Exception ;
	
	@SuppressWarnings("unchecked")
	/**
	 * author:glin 2011-4-5
	 * 查询单个对象
	 * Parameter:
	 * String	hql 查询对象的hql 语句
	 * String[]	param
	 * return object
	 * throws Exception
	 */
	public T querySingleDao(String hql, List param) throws Exception;
	
	@SuppressWarnings("unchecked")
	public List queryAllDao(String hql) throws Exception ;
	
	@SuppressWarnings("unchecked")
	public PageModel queryByParamDao(String hql,String countHQL,List param,int offset,int pageSize) throws Exception ;	
}
